import service from "@/utils/request";

//获取竞赛列表
export function getExamListService(params) {
  return service({
    url: "/exam/list",
    method: "get",
    params,
  });
}

//添加竞赛
export function examAddService(params = {}) {
  return service({
    url: "/exam/add",
    method: "post",
    data: params,
  });
}

//添加竞赛中的题目
export function addExamQuestionService(params = {}) {
  return service({
    url: "/exam/question/add",
    method: "post",
    data: params,
  });
}

//获取竞赛详情
export function getExamDetailService(examId) {
  return service({
    url: "/exam/detail",
    method: "get",
    params: { examId },
  });
}

//编辑竞赛
export function editExamService(params) {
  return service({
    url: "/exam/edit",
    method: "put",
    data: params,
  });
}

//删除竞赛中的题目
export function deleteExamQuestionService(examId, questionId) {
  return service({
    url: "/exam/question/delete",
    method: "delete",
    params: { examId, questionId },
  });
}


//删除竞赛
export function deleteExamService(examId) {
  return service({
    url: "/exam/delete",
    method: "delete",
    params: { examId },
  });
}


//发布竞赛
export function publishExamService(examId){
  return service({
    url: "/exam/publish",
    method: "put",
    params: { examId },
  });
}

//撤销竞赛
export function cancelPublishExamService(examId){
  return service({
    url: "/exam/cancelPublish",
    method: "put",
    params: { examId },
  });
}